#include "Score.h"


Score::Score()
:SpriteText(SCORE_TEXT_PATH, TTF_STYLE_NORMAL, "000000", SCORE_TEXT_SIZE, 164, 50)
, changeMade(false)
{
	score = 0;
}	

Score::Score(int x, int y, const std::string& message)
: SpriteText(SCORE_TEXT_PATH, TTF_STYLE_NORMAL, message, SCORE_TEXT_SIZE, x, y)
, changeMade(false)
{
	score = 0;
}

void Score::Update(float dt)
{
	if (changeMade)
	{
		std::stringstream ss;
		ss << std::setfill('0') << std::setw(6) << score;
		SetMessage(ss.str());

		changeMade = false;
	}
}

void Score::AddPoints(int points)
{
	score += points;
	changeMade = true;
}

Score::~Score()
{
}
